Data storage device and detection method for flash memory

ABSTRACT

A detection method for detecting a programming operation of a flash memory includes issuing a program command of the programming operation to the flash memory, by a controller, issuing a first read status command to the flash memory, by the controller, before a page program time of the flash memory has been reached, and determining whether the programming operation is performed in the flash memory according to a first memory status corresponding to the first read status command provided by the flash memory.

CROSS REFERENCE TO RELATED APPLICATIONS

This Application is a Divisional of pending U.S. patent application Ser. No. 15/288,012, filed on Oct. 7, 2016, which claims priority of Taiwan Patent Application No. 104134820, filed on Oct. 23, 2015, the entireties of which are incorporated by reference herein.

BACKGROUND OF THE INVENTION

Field of the Invention

The invention relates to a data storage device, and more particularly to a data storage device for detecting a programming operation.

Description of the Related Art

Flash memory is a common non-volatile data storage device, which can be erased and programmed electrically. For example, an NAND flash memory is usually for use in a memory card, a USB flash device, a solid-state disk (SSD), an embedded multimedia card, etc. In recent years, flash memories have been made to have the characteristics of data non-volatility, low power consumption, compact size, and non-mechanical structure. Hence, flash memories have been adapted for use in various electronic devices, especially portable electronic devices.

A flash memory comprises a plurality of blocks, and each block comprises a plurality of pages for data storage. When the flash memory receives a program (write) command from a controller, the flash memory writes data to pages of the blocks thereof according to instructions of the controller and the program address. When the flash memory receives a read command from the controller, the flash memory reads data from pages of the blocks thereof according to the instructions of the controller and the program address, and then issues read-out data back to the controller. However, if an unexpected situation occurs when the data is stored into the flash memory, the programming operation may result in failure. If the controller cannot instantly detect that the programming operation has failed, it may be because the read data is wrong.

Therefore, a detection method to determine whether a programming operation of a flash memory is normal is desirable.

BRIEF SUMMARY OF THE INVENTION

A data storage device and a detection method for detecting a programming operation of a flash memory are provided. An embodiment of a data storage device is provided. The data storage device comprises a flash memory and a controller. The flash memory comprises a memory array. The controller performs a programming operation for the flash memory. After the controller issues a program command of the programming operation to the flash memory, the controller issues a first read status command to the flash memory before a page program time of the flash memory has been reached, and the controller determines whether the programming operation is performed in the flash memory according to a first memory status provided by the flash memory.

Furthermore, an embodiment of a detection method for detecting a programming operation of a flash memory is provided. A program command of the programming operation is issued to the flash memory, by a controller. A first read status command is issued to the flash memory before a page program time of the flash memory has been reached, by the controller. It is determining whether the programming operation is performed in the flash memory according to a first memory status corresponding to the first read status command provided by the flash memory.

A detailed description is given in the following embodiments with reference to the accompanying drawings.

BRIEF DESCRIPTION OF DRAWINGS

The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:

FIG. 1 shows a data storage device according to an embodiment of the invention;

FIG. 2 shows an exemplary waveform diagram illustrating the signals between the controller and the flash memory of FIG. 1 according to an embodiment of the invention; and

FIG. 3 shows a detection method for detecting a programming operation of a flash memory according to an embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.

FIG. 1 shows a data storage device 100 according to an embodiment of the invention. The data storage device 100 comprises a controller 110 and a flash memory 120, wherein the flash memory 120 comprises a data register 130 and a memory array 140 formed by a plurality of memory cells. In one embodiment, the data register 130 may be a cache register. The data storage device 100 can be implemented in different electronic apparatus, so that various devices within the electronic apparatus can access the data storage device 100 to perform specific functions. In response to the commands from the other devices (e.g. a master device) of the electronic apparatus, the controller 110 can access the memory array 140 of the flash memory 120. For example, when a master device will write data into the data storage device 100, the controller 110 performs a programming operation in response to a write command from the master device, so as to store the data from the master device into the memory array 140. If the programming operation has failed, the data storage device 100 will notify the master device, thus the master device can re-write the data into the data storage device 100 or perform subsequent operations. Details of how the controller 110 detects the programming operation for the flash memory 120 are described below.

Traditionally, a controller can obtain the status of a flash memory via the flash memory, to determine whether a programming operation of the flash memory has succeeded. For example, if the status of the flash memory is “E0h”, the flash memory has succeeded, wherein “E0h” represents that the flash memory is idle, i.e. the flash memory has completed the programming operation and then the flash memory enters an idle mode. Conversely, if the status of the flash memory is “E1h”, the flash memory has failed. However, in the programming operation, if an unexpected situation occurs, the flash memory may remain in the idle mode without entering a busy mode. Thus, the controller can obtain the status “E0h” of the flash memory, and then it makes an erroneous determination that the programming operation has succeeded. Compared with a traditional controller, the controller 110 of FIG. 1 can detect whether the flash memory enters a busy mode in a programming operation, thereby avoiding the erroneous determination.

FIG. 2 shows an exemplary waveform diagram illustrating the signals between the controller 110 and the flash memory 120 of FIG. 1 according to an embodiment of the invention. In the embodiment, a signal ALE represents an address latch enable signal. A signal I/O represents the signal transmitted in an input/output bus. For convenience of explanation, the signal I/O is divided into a signal I and a signal O, wherein the signal I represents the signal transmitted from the controller 110 to the flash memory 120 in the input/output bus, and the signal O represents the signal transmitted from the flash memory 120 to the controller 110 in the input/output bus. In the embodiment, when performing a programming operation, the controller 110 can issue “80h”, “Addr”, “D_(IN)” and “10h” to the flash memory 120 via the input/output bus in sequence. In the embodiment, “80h” represents a serial data input command, “Addr” represents a program address, “D_(IN)” represents the program data, and “10h” represents a program command. Furthermore, when the controller 110 issues the program address Addr to the flash memory 120, the controller 110 also enables the signal ALE. After issuing the program command “10h” to the flash memory 120, the controller 110 will instantly issue “70h” to the flash memory 120, wherein “70h” represents a read status command. In response to the read status command, the flash memory 120 provides the current status S1 to the controller 110, i.e. the flash memory 120 will provide/return the status to the controller 110. Thus, the controller 110 can determine whether the programming operation is performed in the flash memory 120, i.e. it is determined whether the flash memory 120 enters a busy mode. If the flash memory 120 does not enter the busy mode, the controller 110 determines that the programming operation has failed (e.g. the status S1 is “E0h”), and then the subsequent operations are performed. It should be noted that the controller 110 issues the read status command to the flash memory 120 and receives the status S1 from the flash memory 120 before a page program time t_(PROG) of the flash memory 120 has been reached. In the flash memory 120, the page program time t_(PROG) represents the shortest time that the data register 130 stores the program data D_(IN) into the memory array 140 according to the program address Addr. In one embodiment, the controller 110 uses a timer to count time after issuing the program command, so as to receive the status S1 during the page program time t_(PROG). Conversely, if the flash memory 120 enters a busy mode (e.g. the status S1 is “80h”), the controller 110 issues the read status command “70h” to the flash memory 120 again after reaching the page program time t_(PROG). In response to the read status command, the flash memory 120 provides the current status S2 to the controller 110, i.e. the flash memory 120 returns the status to the controller 110. Thus, the controller 110 can determine whether the programming operation has succeeded in the flash memory 120, i.e. it is detected whether the flash memory 120 enters an idle mode. If the flash memory 120 does not enter the idle mode (e.g. the status S2 is “E1h”), the controller 110 can determine that the programming operation has failed, and then the subsequent operations are performed. Conversely, if the flash memory 120 enters the idle mode (e.g. the status S2 is “E0h”), the controller 110 determines that the programming operation has succeeded.

FIG. 3 shows a detection method for detecting a programming operation of a flash memory according to an embodiment of the invention. In the embodiment, the detection method is performed by a controller of the flash memory. First, in step S310, the controller issues a data input command (e.g. “80h”), a program address, program data and a program command (e.g. “10h”) to the flash memory in sequence, so as to control the flash memory to perform a programming operation. Next, before reaching the page program time t_(PROG) of the flash memory, the controller issues a first read status command (e.g. “70h”) to the flash memory (step S320), so as to obtain a status S1 returned by the flash memory (step S330). Next, in step S340, the controller determines whether the flash memory enters a busy mode according to the status S1, i.e. it is determined whether the status S1 is “80h”. If the flash memory does not enter the busy mode, the controller determines that the programming operation has failed (step S380). Conversely, if the flash memory enters the busy mode, the controller 110 issues a second read status command (e.g. “70h”) to the flash memory (step S350) after reaching the page program time t_(PROG), so as to obtain a status S2 returned by the flash memory (step S360). Next, in step S370, the controller determines whether the flash memory enters an idle mode according to the status S2, i.e. it is determined whether the status S2 is“E0h”. If the flash memory does not enter the idle mode (e.g. the status S2 is “E1h”), the controller determines that the programming operation has failed (step S380). Conversely, if the flash memory enters the idle mode, the controller determines that the programming operation has succeeded (step S390).

According to the embodiments of the invention, the controller can obtains a status of the flash memory during the page program time t_(PROG). Thus, in the programming operation, when an unexpected situation occurs in the flash memory, the controller can accurately determine whether the programming operation is performed in the flash memory during the page program time t_(PROG), and further determine whether the programming operation has succeeded.

While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements. 

What is claimed is:
 1. A detection method for detecting a programming operation of a flash memory, comprising: issuing a program command of the programming operation to the flash memory, by a controller; issuing a first read status command to the flash memory, by the controller, before a page program time of the flash memory has been reached; and determining whether the programming operation is performed in the flash memory according to a first memory status corresponding to the first read status command provided by the flash memory.
 2. The detection method as claimed in claim 1, wherein the step of determining whether the programming operation is performed in the flash memory further comprises: determining that the programming operation has not be performed in the flash memory when the first memory status indicates that the flash memory is idle.
 3. The detection method as claimed in claim 2, wherein when the flash memory is idle, the first memory status provided by the flash memory is E0h.
 4. The detection method as claimed in claim 1, wherein the step of determining whether the programming operation is performed in the flash memory further comprises: determining that the programming operation is being performed in the flash memory when the first memory status indicates that the flash memory is busy.
 5. The detection method as claimed in claim 4, wherein when the flash memory is busy, the first memory status provided by the flash memory is 80h.
 6. The detection method as claimed in claim 1, further comprising: issuing a second read status command to the flash memory after exceeding the page program time of the flash memory when determining that the programming operation is being performed in the flash memory, by the controller; and determining whether the programming operation has succeeded according to a second memory status provided by the flash memory and corresponding to the second read status command.
 7. The detection method as claimed in claim 6, wherein the step of determining whether the programming operation has succeeded further comprises: determining that the programming operation has succeeded when the second memory status provided by the flash memory is E0h.
 8. The detection method as claimed in claim 6, wherein the step of determining whether the programming operation has succeeded further comprises: determining that the programming operation has failed when the second memory status provided by the flash memory is E1h.
 9. The detection method as claimed in claim 1, further comprising: issuing a serial data input command, a program address, and program data to the flash memory, by the controller, before issuing the program command of the programming operation.
 10. The detection method as claimed in claim 9, wherein in the programming operation, the flash memory stores the program data into a memory array of the flash memory according to the program address in response to the program command. 